package com.liu;

import com.liu.factory.AbstractFactory;
import com.liu.product.Product;
import com.liu.utils.ReadXML;

/**
 * 工厂方法
 *
 * @author liubo
 */
public class FactoryMethod {

    public static void main(String[] args) {
        Product product = null;
        AbstractFactory abstractFactory = null;
        String filePath = "factory-pattern/src/main/resources/config/config.xml";
        try {
            abstractFactory = (AbstractFactory) ReadXML.getObject(filePath);
            product = abstractFactory.newProduct();
            product.name();
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
    }
}
